<template>
  <transition name="el-zoom-in-center">
    <div class="JADP-preview-main user-form">
      <div class="JADP-common-page-header">
        <el-page-header
          @back="goBack"
          :content="!dataForm.id ? $t(`user.addUser`) : $t(`user.editUser`)"
        />
        <div class="options">
          <el-button
            type="primary"
            :loading="btnLoading"
            @click="handleConfirm()"
          >
            {{ $t("common.confirmButton") }}</el-button
          >
          <el-button @click="goBack"
            >{{ $t("common.cancelButton") }}
          </el-button>
        </div>
      </div>
      <div
        class="main"
        v-loading="formLoading"
        :element-loading-text="$t('common.loadingText')"
      >
        <el-form
          ref="dataForm"
          :model="dataForm"
          :rules="dataRule"
          size="small"
          label-width="100px"
          label-position="right"
        >
          <el-col :span="12">
            <el-form-item label="人员照片" label-width="160px" prop="headIcon">
              <JADP-UploadImg
                v-model="photoList"
                :fileSize="100"
                sizeUnit="MB"
                :limit="1"
                showTip
              >
              </JADP-UploadImg>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="员工编码" prop="account">
              <el-input
                v-model="dataForm.account"
                placeholder="系统自动生成"
                readonly
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="员工姓名" prop="realName">
              <el-input
                v-model="dataForm.realName"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="身份证号码" prop="idcardno">
              <el-input
                v-model="dataForm.idcardno"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="工作状态" prop="workingcondition">
              <el-select
                v-model="dataForm.workingcondition"
                placeholder="请选择"
                clearable
                :style="{ width: '100%' }"
                :multiple="false"
              >
                <el-option
                  v-for="(item, index) in workingconditionOptions"
                  :key="index"
                  :label="item.fullName"
                  :value="item.id"
                  :disabled="item.disabled"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="联系电话" prop="telephoneno">
              <el-input
                v-model="dataForm.telephoneno"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="工号" prop="jobno">
              <el-input
                v-model="dataForm.jobno"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="性别" prop="gender">
              <el-select
                v-model="dataForm.gender"
                placeholder="请选择"
                clearable
                :style="{ width: '100%' }"
                :multiple="false"
              >
                <el-option
                  v-for="item in genderTreeData"
                  :key="item.enCode"
                  :label="item.fullName"
                  :value="item.enCode"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="入厂日期" prop="entrydate">
              <el-date-picker
                v-model="dataForm.entrydate"
                placeholder="请选择"
                clearable
                :style="{ width: '100%' }"
                type="date"
                format="yyyy-MM-dd"
                value-format="timestamp"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="年龄" prop="age">
              <el-input
                v-model="dataForm.age"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="所属公司" prop="originalcompany">
              <com-select
                v-model="dataForm.originalcompany"
                placeholder="请选择"
              >
              </com-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="出生年月" prop="birthday">
              <el-date-picker
                v-model="dataForm.birthday"
                placeholder="请选择"
                clearable
                :style="{ width: '100%' }"
                type="date"
                format="yyyy-MM-dd"
                value-format="timestamp"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="所属部门" prop="department">
              <dep-select v-model="dataForm.department" placeholder="请选择">
              </dep-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="民族" prop="nation">
              <el-input
                v-model="dataForm.nation"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="岗位" prop="post">
              <pos-select
                v-model="dataForm.post"
                placeholder="请选择"
                :multiple="false"
              >
              </pos-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="籍贯" prop="nativeplace">
              <el-input
                v-model="dataForm.nativeplace"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="工种" prop="worktype">
              <el-input
                v-model="dataForm.worktype"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="学历" prop="education">
              <el-select
                v-model="dataForm.education"
                placeholder="请选择"
                clearable
                :style="{ width: '100%' }"
                :multiple="false"
              >
                <el-option
                  v-for="(item, index) in educationTreeData"
                  :key="index"
                  :label="item.fullName"
                  :value="item.id"
                  :disabled="item.disabled"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 无 -->
          <el-col :span="12">
            <el-form-item label="家庭住址" prop="homeaddress">
              <el-input
                v-model="dataForm.homeaddress"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-tabs v-model="activeName" @tab-click="handleClick">
              <el-tab-pane label="转岗/调岗记录" name="转岗/调岗记录">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <el-table
                      :data="dataForm.xy_hse_ar_jobtransferrecordEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column
                        prop="positionchangecode"
                        label="岗位变更编码"
                      >
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.positionchangecode"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="changenature" label="变更性质">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.changenature"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="changetime" label="变更时间">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.changetime"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="date"
                            format="yyyy-MM-dd"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="originalcompany"
                        label="原所属公司"
                      >
                        <template slot-scope="scope">
                          <com-select
                            v-model="scope.row.originalcompany"
                            placeholder="请选择"
                          >
                          </com-select>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="originaldepartment"
                        label="原所属部门"
                      >
                        <template slot-scope="scope">
                          <dep-select
                            v-model="scope.row.originaldepartment"
                            placeholder="请选择"
                          >
                          </dep-select>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="companyafterchange"
                        label="变更后公司"
                      >
                        <template slot-scope="scope">
                          <com-select
                            v-model="scope.row.companyafterchange"
                            placeholder="请选择"
                          >
                          </com-select>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="deoartmentafterchange"
                        label="变更后部门"
                      >
                        <template slot-scope="scope">
                          <dep-select
                            v-model="scope.row.deoartmentafterchange"
                            placeholder="请选择"
                          >
                          </dep-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="jobafterchange" label="变更后岗位">
                        <template slot-scope="scope">
                          <pos-select
                            v-model="scope.row.jobafterchange"
                            placeholder="请选择"
                            :multiple="false"
                          >
                          </pos-select>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_ar_jobtransferrecordEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <div
                      class="table-actions"
                      @click="addHandlexy_hse_ar_jobtransferrecordEntityList()"
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div>
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="培训记录" name="培训记录">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <el-table
                      :data="dataForm.xy_hse_ar_trainingrecordEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column prop="trainingname" label="培训名称">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.trainingname"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="trainingtype" label="培训类别">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.trainingtype"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in trainingtypeOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="traininglevel" label="培训级别">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.traininglevel"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in traininglevelOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="trainingway" label="培训方式">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.trainingway"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in trainingwayOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="testway" label="考试方式">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.testway"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in testwayOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="testresult" label="考试成绩">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.testresult"
                            placeholder="请输入"
                            oninput="value=value.replace(/[^0-9.]/g,'')"
                            :min="0"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="passcondition" label="是否通过">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.passcondition"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in passconditionOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="remark" label="备注">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.remark"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_ar_trainingrecordEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <div
                      class="table-actions"
                      @click="addHandlexy_hse_ar_trainingrecordEntityList()"
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div>
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="特种作业证" name="特种作业证">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <el-table
                      :data="dataForm.xy_hse_tr_personneldocumentsEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column prop="certificatename" label="证件名称">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.certificatename"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="certificatenumber"
                        label="证件号码"
                      >
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.certificatenumber"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="effectivedate" label="生效日期">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.effectivedate"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="date"
                            format="yyyy-MM-dd"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column prop="expirydate" label="失效日期">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.expirydate"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="date"
                            format="yyyy-MM-dd"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="annualverification"
                        label="是否年审"
                      >
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.annualverification"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in annualverificationOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="nextcheckdate" label="下次复检日">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.nextcheckdate"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="date"
                            format="yyyy-MM-dd"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column prop="status" label="状态">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.status"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in statusOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_tr_personneldocumentsEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <div
                      class="table-actions"
                      @click="addHandlexy_hse_tr_personneldocumentsEntityList()"
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div>
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="安全目标责任书" name="安全目标责任书">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <el-table
                      :data="dataForm.xy_hse_ar_safetyresponsibilityEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column prop="file" label="附件">
                        <!-- <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.file"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template> -->
                        <template #default="{ $index }">
                          <el-button type="text" @click="upload($index)"
                            >上传/预览附件</el-button
                          >
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_ar_safetyresponsibilityEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <div
                      class="table-actions"
                      @click="
                        addHandlexy_hse_ar_safetyresponsibilityEntityList()
                      "
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div>
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="防护用品领用登记" name="防护用品领用登记">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <div class="JADP-common-title">
                      <h2></h2>
                    </div>
                    <el-table
                      :data="dataForm.xy_hse_zyjkgl_lbypconsumEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column prop="consumtime" label="领用时间">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.consumtime"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="datetime"
                            format="yyyy-MM-dd HH:mm:ss"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column prop="ldypname" label="劳动用品名称">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.ldypname"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="ldypmode" label="规格型号">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.ldypmode"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="ldypquantit" label="数量">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.ldypquantit"
                            placeholder="请输入"
                            onkeyup="value=value.replace(/[^\d.]/g,'')"
                            type="number"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="distributdept" label="发放部门">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.distributdept"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="dstributer" label="发放人">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.dstributer"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_zyjkgl_lbypconsumEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <!-- <div
                      class="table-actions"
                      @click="addHandlexy_hse_zyjkgl_lbypconsumEntityList()"
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div> -->
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="违章记录" name="违章记录">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <el-table
                      :data="dataForm.xy_hse_js_violationmanagementEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column prop="violationname" label="违章名称">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.violationname"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="violationtype" label="违章类型">
                        <template slot-scope="scope">
                          <el-select
                            v-model="scope.row.violationtype"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            :multiple="false"
                          >
                            <el-option
                              v-for="(item, index) in violationtypeOptions"
                              :key="index"
                              :label="item.fullName"
                              :value="item.id"
                              :disabled="item.disabled"
                            ></el-option>
                          </el-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="occurrencetime" label="违章时间">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.occurrencetime"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="datetime"
                            format="yyyy-MM-dd HH:mm:ss"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="accidentdescription"
                        label="违章描述"
                      >
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.accidentdescription"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="inspector" label="检查人员">
                        <template slot-scope="scope">
                          <user-select
                            v-model="scope.row.inspector"
                            placeholder="请选择"
                            :multiple="true"
                          >
                          </user-select>
                        </template>
                      </el-table-column>
                      <el-table-column prop="checktime" label="检查时间">
                        <template slot-scope="scope">
                          <el-date-picker
                            v-model="scope.row.checktime"
                            placeholder="请选择"
                            clearable
                            :style="{ width: '100%' }"
                            type="datetime"
                            format="yyyy-MM-dd HH:mm:ss"
                            value-format="timestamp"
                          >
                          </el-date-picker>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="penaltyamount"
                        label="处罚金额（元）"
                      >
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.penaltyamount"
                            placeholder="请输入"
                            onkeyup="value=value.replace(/[^\d.]/g,'')"
                            type="number"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="violationphotos" label="违章照片">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.violationphotos"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_js_violationmanagementEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <!-- <div
                      class="table-actions"
                      @click="
                        addHandlexy_hse_js_violationmanagementEntityList()
                      "
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div> -->
                  </el-form-item>
                </el-col>
              </el-tab-pane>
              <el-tab-pane label="职业健康体检" name="职业健康体检">
                <el-col :span="24">
                  <el-form-item label-width="0">
                    <div class="JADP-common-title">
                      <h2></h2>
                    </div>
                    <el-table
                      :data="dataForm.xy_hse_zyjkgl_zbtjryqdEntityList"
                      size="mini"
                    >
                      <el-table-column
                        type="index"
                        width="50"
                        label="序号"
                        align="center"
                      />
                      <el-table-column
                        prop="exposure"
                        label="接触职业病危害因素"
                      >
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.exposure"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="diseases" label="可能导致的职业病">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.diseases"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column
                        prop="conclusion"
                        label="体检结论与处理意见"
                      >
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.conclusion"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="recheck" label="是否复检">
                        <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.recheck"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="enclosure" label="附件">
                        <!--  <template slot-scope="scope">
                          <el-input
                            v-model="scope.row.enclosure"
                            placeholder="请输入"
                            clearable
                            :style="{ width: '100%' }"
                          >
                          </el-input>
                        </template> -->
                        <template #default="{ $index }">
                          <el-button type="text" @click="uploads($index)"
                            >上传/预览附件</el-button
                          >
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="50">
                        <template slot-scope="scope">
                          <el-button
                            size="mini"
                            type="text"
                            class="JADP-table-delBtn"
                            @click="
                              handleDelxy_hse_zyjkgl_zbtjryqdEntityList(
                                scope.$index
                              )
                            "
                            >删除
                          </el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                    <!-- <div
                      class="table-actions"
                      @click="addHandlexy_hse_zyjkgl_zbtjryqdEntityList()"
                    >
                      <el-button type="text" icon="el-icon-plus"
                        >新增</el-button
                      >
                    </div> -->
                  </el-form-item>
                </el-col>
              </el-tab-pane>
            </el-tabs>
          </el-col>
        </el-form>
        <!-- 之前的结构 -->
        <!-- <el-form
          ref="dataForm"
          :model="dataForm"
          :rules="dataRule"
          size="mini"
          label-width="100px"
          label-position="right"
        >
          <div class="JADP-common-title mb-20">
            <h2 class="bold">基础信息</h2>
          </div>
          <el-row
            :gutter="30"
            class="main"
            :style="{ margin: '0 auto', width: '100%' }"
          >
            <el-col :span="12">
              <el-form-item label="头像" label-width="160px" prop="headIcon">
               
                <el-upload
                  class="avatar-uploader"
                  :action="define.comUploadUrl + '/userAvatar'"
                  :show-file-list="false"
                  :on-success="handleAvatarSuccess"
                  accept="image/*"
                >
                  <img
                    v-if="dataForm.headIcon"
                    :src="define.comUrl + dataForm.headIcon"
                    class="avatar"
                  />
                  <i v-else class="el-icon-plus avatar-uploader-icon" />
                </el-upload>
              </el-form-item>
            </el-col>

            <el-col :sm="12" :xs="24">
              <el-form-item label="员工编码" prop="account">
                <el-input v-model="dataForm.account" placeholder="员工编码" />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="员工姓名" prop="realName">
                <el-input v-model="dataForm.realName" placeholder="员工姓名" />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="性别" prop="gender">
                <el-select v-model="dataForm.gender" placeholder="选择性别">
                  <el-option
                    v-for="item in genderTreeData"
                    :key="item.enCode"
                    :label="item.fullName"
                    :value="item.enCode"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
             
              <el-col :span="12">
                <el-form-item label="工作状态" prop="workingcondition">
                  <el-select
                    v-model="dataForm.workingcondition"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                    :multiple="false"
                  >
                    <el-option
                      v-for="(item, index) in workingconditionOptions"
                      :key="index"
                      :label="item.fullName"
                      :value="item.id"
                      :disabled="item.disabled"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="电子邮箱" prop="email">
                <el-input v-model="dataForm.email" placeholder="电子邮箱" />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="部门" prop="organizeId">
                <JADP-TreeSelect
                  v-model="dataForm.organizeId"
                  :options="departmentTreeData"
                  lastLevel
                  lastLevelKey="type"
                  lastLevelValue="department"
                  placeholder="选择部门"
                  clearable
                />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="直属主管" prop="managerId">
                <user-select-xy
                  v-model="dataForm.managerId"
                  placeholder="选择直属主管"
                />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="岗位" prop="positionId">
                <JADP-TreeSelect
                  v-model="dataForm.positionId"
                  :options="positionTreeData"
                  multiple
                  lastLevel
                  lastLevelKey="type"
                  lastLevelValue="position"
                  placeholder="选择岗位"
                  clearable
                />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="角色" prop="roleId">
                <el-select v-model="roleId" multiple placeholder="请选择" @change="roleIdChange"
                  filterable>
                  <el-option-group v-for="group in roleTreeData" :key="group.id"
                    :label="group.fullName+(group.num?'【'+group.num+'】':'')">
                    <el-option v-for="item in group.children" :key="item.id" :label="item.fullName"
                      :value="item.id">
                    </el-option>
                  </el-option-group>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="排序" prop="sortCode">
                <el-input-number :min="0" :max="9999" v-model="dataForm.sortCode"
                  controls-position="right" />
              </el-form-item>
            </el-col>

            <el-col :span="24">
              <el-form-item label="备注" prop="description">
                <el-input
                  v-model="dataForm.description"
                  type="textarea"
                  :rows="6"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <div class="JADP-common-title mb-20">
            <h2 class="bold">扩展信息</h2>
          </div> 
          <el-row :gutter="20" class="custom-row">
             <el-col :sm="12" :xs="24">
              <el-form-item label="民族" prop="nation">
                <el-select
                  v-model="dataForm.nation"
                  placeholder="选择民族"
                  filterable
                >
                  <el-option
                    v-for="item in nationTreeData"
                    :key="item.id"
                    :label="item.fullName"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="籍贯" prop="nativePlace">
                <el-input v-model="dataForm.nativePlace" placeholder="籍贯" />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="入职时间" prop="entryDate">
                <el-date-picker
                  v-model="dataForm.entryDate"
                  type="date"
                  placeholder="选择入职时间"
                  value-format="timestamp"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="证件类型" prop="certificatesType">
                <el-select
                  v-model="dataForm.certificatesType"
                  placeholder="选择证件类型"
                >
                  <el-option
                    v-for="item in certificatesTypeTreeData"
                    :key="item.id"
                    :label="item.fullName"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="证件号码" prop="certificatesNumber">
                <el-input
                  v-model="dataForm.certificatesNumber"
                  placeholder="证件号码"
                />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="文化程度" prop="education">
                <el-select
                  v-model="dataForm.education"
                  placeholder="选择文化程度"
                >
                  <el-option
                    v-for="item in educationTreeData"
                    :key="item.id"
                    :label="item.fullName"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="出生年月" prop="birthday">
                <el-date-picker
                  v-model="dataForm.birthday"
                  type="date"
                  placeholder="选择出生年月"
                  value-format="timestamp"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="办公电话" prop="telePhone">
                <el-input v-model="dataForm.telePhone" placeholder="办公电话" />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="办公座机" prop="landline">
                <el-input v-model="dataForm.landline" placeholder="办公座机" />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="手机号码" prop="mobilePhone">
                <el-input
                  v-model="dataForm.mobilePhone"
                  placeholder="手机号码"
                />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="紧急联系" prop="urgentContacts">
                <el-input
                  v-model="dataForm.urgentContacts"
                  placeholder="紧急联系人"
                />
              </el-form-item>
            </el-col>
            <el-col :sm="12" :xs="24">
              <el-form-item label="紧急电话" prop="urgentTelePhone">
                <el-input
                  v-model="dataForm.urgentTelePhone"
                  placeholder="紧急联系人电话"
                />
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="通讯地址" prop="postalAddress">
                <el-input
                  v-model="dataForm.postalAddress"
                  type="textarea"
                  :rows="6"
                />
              </el-form-item>
            </el-col> 
            <el-col :span="24">
              <el-tabs v-model="activeName">
                <el-tab-pane label="转岗/调岗记录" name="转岗/调岗记录">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <el-table
                        :data="dataForm.xy_hse_ar_jobtransferrecordEntityList"
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column
                          prop="positionchangecode"
                          label="岗位变更编码"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.positionchangecode"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="changenature" label="变更性质">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.changenature"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="changetime" label="变更时间">
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.changetime"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="date"
                              format="yyyy-MM-dd"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="originalcompany"
                          label="原所属公司"
                        >
                          <template slot-scope="scope">
                            <com-select
                              v-model="scope.row.originalcompany"
                              placeholder="请选择"
                            >
                            </com-select>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="originaldepartment"
                          label="原所属部门"
                        >
                          <template slot-scope="scope">
                            <dep-select
                              v-model="scope.row.originaldepartment"
                              placeholder="请选择"
                            >
                            </dep-select>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="companyafterchange"
                          label="变更后公司"
                        >
                          <template slot-scope="scope">
                            <com-select
                              v-model="scope.row.companyafterchange"
                              placeholder="请选择"
                            >
                            </com-select>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="deoartmentafterchange"
                          label="变更后部门"
                        >
                          <template slot-scope="scope">
                            <dep-select
                              v-model="scope.row.deoartmentafterchange"
                              placeholder="请选择"
                            >
                            </dep-select>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="jobafterchange"
                          label="变更后岗位"
                        >
                          <template slot-scope="scope">
                            <pos-select
                              v-model="scope.row.jobafterchange"
                              placeholder="请选择"
                              :multiple="false"
                            >
                            </pos-select>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_ar_jobtransferrecordEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="
                          addHandlexy_hse_ar_jobtransferrecordEntityList()
                        "
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
                <el-tab-pane label="培训记录" name="培训记录">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <el-table
                        :data="dataForm.xy_hse_ar_trainingrecordEntityList"
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column prop="trainingname" label="培训名称">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.trainingname"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="trainingtype" label="培训类别">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.trainingtype"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in trainingtypeOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="traininglevel" label="培训级别">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.traininglevel"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in traininglevelOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="trainingway" label="培训方式">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.trainingway"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in trainingwayOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="testway" label="考试方式">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.testway"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in testwayOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="testresult" label="考试成绩">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.testresult"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="passcondition" label="是否通过">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.passcondition"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in passconditionOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="remark" label="备注">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.remark"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_ar_trainingrecordEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="addHandlexy_hse_ar_trainingrecordEntityList()"
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
                <el-tab-pane label="特种作业证" name="特种作业证">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <el-table
                        :data="dataForm.xy_hse_tr_personneldocumentsEntityList"
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column
                          prop="certificatename"
                          label="证件名称"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.certificatename"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="certificatenumber"
                          label="证件号码"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.certificatenumber"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="effectivedate" label="生效日期">
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.effectivedate"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="date"
                              format="yyyy-MM-dd"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column prop="expirydate" label="失效日期">
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.expirydate"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="date"
                              format="yyyy-MM-dd"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="annualverification"
                          label="是否年审"
                        >
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.annualverification"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(
                                  item, index
                                ) in annualverificationOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="nextcheckdate"
                          label="下次复检日"
                        >
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.nextcheckdate"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="date"
                              format="yyyy-MM-dd"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column prop="status" label="状态">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.status"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in statusOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_tr_personneldocumentsEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="
                          addHandlexy_hse_tr_personneldocumentsEntityList()
                        "
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
                <el-tab-pane label="安全目标责任书" name="安全目标责任书">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <el-table
                        :data="
                          dataForm.xy_hse_ar_safetyresponsibilityEntityList
                        "
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column prop="file" label="附件">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.file"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_ar_safetyresponsibilityEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="
                          addHandlexy_hse_ar_safetyresponsibilityEntityList()
                        "
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
                <el-tab-pane label="防护用品领用登记" name="防护用品领用登记">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <div class="JADP-common-title">
                        <h2></h2>
                      </div>
                      <el-table
                        :data="dataForm.xy_hse_zyjkgl_lbypconsumEntityList"
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column prop="consumtime" label="领用时间">
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.consumtime"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="datetime"
                              format="yyyy-MM-dd HH:mm:ss"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column prop="ldypname" label="劳动用品名称">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.ldypname"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="ldypmode" label="规格型号">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.ldypmode"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="ldypquantit" label="数量">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.ldypquantit"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="distributdept" label="发放部门">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.distributdept"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="dstributer" label="发放人">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.dstributer"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_zyjkgl_lbypconsumEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="addHandlexy_hse_zyjkgl_lbypconsumEntityList()"
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
                <el-tab-pane label="违章记录" name="违章记录">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <el-table
                        :data="dataForm.xy_hse_js_violationmanagementEntityList"
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column prop="violationname" label="违章名称">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.violationname"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="violationtype" label="违章类型">
                          <template slot-scope="scope">
                            <el-select
                              v-model="scope.row.violationtype"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              :multiple="false"
                            >
                              <el-option
                                v-for="(item, index) in violationtypeOptions"
                                :key="index"
                                :label="item.fullName"
                                :value="item.id"
                                :disabled="item.disabled"
                              ></el-option>
                            </el-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="occurrencetime" label="违章时间">
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.occurrencetime"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="datetime"
                              format="yyyy-MM-dd HH:mm:ss"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="accidentdescription"
                          label="违章描述"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.accidentdescription"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="inspector" label="检查人员">
                          <template slot-scope="scope">
                            <user-select
                              v-model="scope.row.inspector"
                              placeholder="请选择"
                              :multiple="true"
                            >
                            </user-select>
                          </template>
                        </el-table-column>
                        <el-table-column prop="checktime" label="检查时间">
                          <template slot-scope="scope">
                            <el-date-picker
                              v-model="scope.row.checktime"
                              placeholder="请选择"
                              clearable
                              :style="{ width: '100%' }"
                              type="datetime"
                              format="yyyy-MM-dd HH:mm:ss"
                              value-format="timestamp"
                            >
                            </el-date-picker>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="penaltyamount"
                          label="处罚金额（元）"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.penaltyamount"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="violationphotos"
                          label="违章照片"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.violationphotos"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_js_violationmanagementEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="
                          addHandlexy_hse_js_violationmanagementEntityList()
                        "
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
                <el-tab-pane label="职业健康体检" name="职业健康体检">
                  <el-col :span="24">
                    <el-form-item label-width="0">
                      <div class="JADP-common-title">
                        <h2></h2>
                      </div>
                      <el-table
                        :data="dataForm.xy_hse_zyjkgl_zbtjryqdEntityList"
                        size="mini"
                      >
                        <el-table-column
                          type="index"
                          width="50"
                          label="序号"
                          align="center"
                        />
                        <el-table-column
                          prop="exposure"
                          label="接触职业病危害因素"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.exposure"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="diseases"
                          label="可能导致的职业病"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.diseases"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column
                          prop="conclusion"
                          label="体检结论与处理意见"
                        >
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.conclusion"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="recheck" label="是否复检">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.recheck"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column prop="enclosure" label="附件">
                          <template slot-scope="scope">
                            <el-input
                              v-model="scope.row.enclosure"
                              placeholder="请输入"
                              clearable
                              :style="{ width: '100%' }"
                            >
                            </el-input>
                          </template>
                        </el-table-column>
                        <el-table-column label="操作" width="50">
                          <template slot-scope="scope">
                            <el-button
                              size="mini"
                              type="text"
                              class="JADP-table-delBtn"
                              @click="
                                handleDelxy_hse_zyjkgl_zbtjryqdEntityList(
                                  scope.$index
                                )
                              "
                              >删除
                            </el-button>
                          </template>
                        </el-table-column>
                      </el-table>
                      <div
                        class="table-actions"
                        @click="addHandlexy_hse_zyjkgl_zbtjryqdEntityList()"
                      >
                        <el-button type="text" icon="el-icon-plus"
                          >新增</el-button
                        >
                      </div>
                    </el-form-item>
                  </el-col>
                </el-tab-pane>
              </el-tabs>
            </el-col>
          </el-row>
        </el-form> -->
      </div>
      <Upload
        :visible.sync="uplaodVisible"
        :value.sync="file"
        @updateUpload="updateUpload"
      />
    </div>
  </transition>
</template>

<script>
import { getDepartmentSelector } from "@/api/permission/departmentXy";
import { getPositionSelector } from "@/api/permission/positionXy";
import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { createUser, updateUser, getUserInfo } from "@/api/permission/userXy";
import Upload from "@/components/Generator/components/Upload/upload.vue";
export default {
  components: { Upload },
  data() {
    // var checkIdentitytionId = (rule, value, callback) => {
    //   if (!value) {
    //     return callback(new Error("身份证号不能为空"));
    //   }
    //   if (!/(^\d{15}$)|(^\d{17}(\d|X|x)$)/.test(value)) {
    //     callback(new Error("您输入的身份证长度或格式错误"));
    //   }
    //   //身份证城市
    //   var aCity = {
    //     11: "北京",
    //     12: "天津",
    //     13: "河北",
    //     14: "山西",
    //     15: "内蒙古",
    //     21: "辽宁",
    //     22: "吉林",
    //     23: "黑龙江",
    //     31: "上海",
    //     32: "江苏",
    //     33: "浙江",
    //     34: "安徽",
    //     35: "福建",
    //     36: "江西",
    //     37: "山东",
    //     41: "河南",
    //     42: "湖北",
    //     43: "湖南",
    //     44: "广东",
    //     45: "广西",
    //     46: "海南",
    //     50: "重庆",
    //     51: "四川",
    //     52: "贵州",
    //     53: "云南",
    //     54: "西藏",
    //     61: "陕西",
    //     62: "甘肃",
    //     63: "青海",
    //     64: "宁夏",
    //     65: "新疆",
    //     71: "台湾",
    //     81: "香港",
    //     82: "澳门",
    //     91: "国外",
    //   };
    //   if (!aCity[parseInt(value.substr(0, 2))]) {
    //     callback(new Error("您的身份地区非法"));
    //   }
    //   //出生日期验证
    //   var sBirthday = (
    //       value.substr(6, 4) +
    //       "-" +
    //       Number(value.substr(10, 2)) +
    //       "-" +
    //       Number(value.substr(12, 2))
    //     ).replace(/-/g, "/"),
    //     d = new Date(sBirthday);
    //   if (
    //     sBirthday !=
    //     d.getFullYear() + "/" + (d.getMonth() + 1) + "/" + d.getDate()
    //   ) {
    //     callback(new Error("身份证上的出生日期非法"));
    //   }
    //   //身份证号码校验
    //   var sum = 0,
    //     weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2],
    //     codes = "10X98765432";
    //   for (var i = 0; i < value.length - 1; i++) {
    //     sun += value[i] * weights[i];
    //   }
    //   var lastLevel = codes[sum % 11]; //计算出来的最后一位身份证号码
    //   if (value[value.length - 1] != last) {
    //     callback(new Error("您输入的身份证号非法"));
    //   }
    //   callback();
    // };
    return {
      idx: "",
      idxs: "",
      file: [],
      uplaodVisible: false,
      tabsIndex: "",
      loading: false,
      isDetail: false,
      visible: false,
      btnLoading: false,
      activeName: "转岗/调岗记录",
      dataForm: {
        workingcondition: "",
        id: "",
        sortCode: 0,
        enabledMark: 1,
        account: "",
        realName: "",
        organizeId: "",
        managerId: "",
        positionId: "",
        roleId: "",
        description: "",
        headIcon: "",
        gender: null,
        nationId: "",
        nativePlace: "",
        entryDate: Number,
        certificatesType: "",
        certificatesNumber: "",
        education: "",
        birthday: Number,
        telePhone: "",
        landline: "",
        mobilePhone: "",
        email: "",
        urgentContacts: "",
        urgentTelePhone: "",
        postalAddress: "",
        photo: [],
        employeecode: undefined,
        employeename: undefined,
        idcardno: undefined,
        workingcondition: "",
        telephoneno: undefined,
        jobno: undefined,
        sex: "",
        entrydate: undefined,
        age: undefined,
        company: undefined,
        birthday: undefined,
        department: undefined,
        nation: undefined,
        post: undefined,
        nativeplace: undefined,
        worktype: undefined,
        education: "",
        homeaddress: undefined,
        xy_hse_ar_jobtransferrecordEntityList: [],
        xy_hse_ar_trainingrecordEntityList: [],
        xy_hse_tr_personneldocumentsEntityList: [],
        xy_hse_ar_safetyresponsibilityEntityList: [],
        xy_hse_zyjkgl_lbypconsumEntityList: [],
        xy_hse_js_violationmanagementEntityList: [],
        xy_hse_zyjkgl_zbtjryqdEntityList: [],
        creatoruserid: "",
        creatortime: "",
        lastmodifyuserid: "",
        lastmodifytime: "",
      },
      roleId: [],
      testwayOptions: [],
      departmentTreeData: [],
      trainingtypeOptions: [],
      traininglevelOptions: [],
      trainingwayOptions: [],
      passconditionOptions: [],
      annualverificationOptions: [],
      statusOptions: [],
      violationtypeOptions: [],
      workingconditionOptions: [],
      positionTreeData: [],
      genderTreeData: [],
      nationTreeData: [],
      educationTreeData: [],
      certificatesTypeTreeData: [],
      photoList: [], //人员照片
      formLoading: false,
      genderProps: {
        value: "enCode",
        label: "fullName",
      },
      dataRule: {
        account: [
          { required: true, message: "请输入账户名称", trigger: "blur" },
          {
            validator: this.formValidate(
              "userAccount",
              "账户名称只能是数字英文"
            ),
            trigger: "blur",
          },
          { max: 50, message: "账户名称最多为50个字符！", trigger: "blur" },
        ],
        realName: [
          { required: true, message: "请输入真实姓名", trigger: "blur" },
          {
            validator: this.formValidate(
              "fullName",
              "真实姓名不能含有特殊符号"
            ),
            trigger: "blur",
          },
          { max: 50, message: "真实姓名最多为50个字符！", trigger: "blur" },
        ],
        gender: [{ required: true, message: "请选择性别", trigger: "change" }],
        organizeId: [
          { required: true, message: "请选择部门", trigger: "change" },
        ],
        telephoneno: [
          { required: true, message: "请输入", trigger: "blur" },
          {
            pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/,
            message: "请输入正确的联系方式",
            trigger: "blur",
          },
        ],
        idcardno: [
          {
            required: true,
            message: "请输入",
            trigger: "blur",
          },
          {
            pattern:
              /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
            message: "请输入正确的身份证号码",
            trigger: "blur",
          },
        ],
        age: [
          {
            required: true,
            message: "请输入",
            trigger: "blur",
          },
          {
            pattern: /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/,
            message: "请输入正确的年龄",
            trigger: "blur",
          },
        ],
      },
    };
  },
  created() {
    this.getworkingconditionOptions();
    this.gettestwayOptions();
    this.gettrainingtypeOptions();
    this.gettraininglevelOptions();
    this.gettrainingwayOptions();
    this.getpassconditionOptions();
    this.getannualverificationOptions();
    this.getstatusOptions();
    this.getviolationtypeOptions();
  },
  methods: {
    updateUpload(val) {
      if (this.tabsIndex === "3") {
        this.dataForm.xy_hse_ar_safetyresponsibilityEntityList[this.idx].file =
          JSON.stringify(val);
      } else if (this.tabsIndex === "6") {
        this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList[this.idxs].enclosure =
          JSON.stringify(val);
      }
    },
    upload(idx) {
      this.idx = idx;
      this.file = this.dataForm.xy_hse_ar_safetyresponsibilityEntityList[
        this.idx
      ].file
        ? JSON.parse(
            this.dataForm.xy_hse_ar_safetyresponsibilityEntityList[this.idx]
              .file
          )
        : [];
      this.uplaodVisible = true;
    },
    uploads(idx) {
      this.idxs = idx;
      this.file = this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList[this.idxs]
        .enclosure
        ? JSON.parse(
            this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList[this.idxs].enclosure
          )
        : [];
      this.uplaodVisible = true;
    },
    handleClick(val) {
      this.tabsIndex = val.index;
    },
    gettestwayOptions() {
      getDictionaryDataSelector("543a29751fc84867984f144ae16c9e4f").then(
        (res) => {
          this.testwayOptions = res.data.list;
        }
      );
    },
    getworkingconditionOptions() {
      getDictionaryDataSelector("3d36d0a746554ea384c984d4440d2c38").then(
        (res) => {
          this.workingconditionOptions = res.data.list;
        }
      );
    },
    gettrainingtypeOptions() {
      getDictionaryDataSelector("946027b8867f419ea1235784e1d53eb8").then(
        (res) => {
          this.trainingtypeOptions = res.data.list;
        }
      );
    },
    gettraininglevelOptions() {
      getDictionaryDataSelector("b20c073d2db84ba0b34b75bd603b3f93").then(
        (res) => {
          this.traininglevelOptions = res.data.list;
        }
      );
    },
    gettrainingwayOptions() {
      getDictionaryDataSelector("defa2ac77c124f5eb62fdf26ba948b87").then(
        (res) => {
          this.trainingwayOptions = res.data.list;
        }
      );
    },
    getpassconditionOptions() {
      getDictionaryDataSelector("9d234d338d914881839f9a7b33153ca4").then(
        (res) => {
          this.passconditionOptions = res.data.list;
        }
      );
    },
    getannualverificationOptions() {
      getDictionaryDataSelector("2d8bab716a0a4f4288a2624615f955b9").then(
        (res) => {
          this.annualverificationOptions = res.data.list;
        }
      );
    },
    getstatusOptions() {
      getDictionaryDataSelector("2c696822b8394fb88a85e41bc37f7115").then(
        (res) => {
          this.statusOptions = res.data.list;
        }
      );
    },
    getviolationtypeOptions() {
      getDictionaryDataSelector("4482371e82004ffd9629926cd5d08177").then(
        (res) => {
          this.violationtypeOptions = res.data.list;
        }
      );
    },
    init(id, organizeId) {
      this.photoList = [];
      this.dataForm.xy_hse_ar_jobtransferrecordEntityList = [];
      this.dataForm.xy_hse_ar_trainingrecordEntityList = [];
      this.dataForm.xy_hse_tr_personneldocumentsEntityList = [];
      this.dataForm.xy_hse_ar_safetyresponsibilityEntityList = [];
      this.dataForm.xy_hse_zyjkgl_lbypconsumEntityList = [];
      this.dataForm.xy_hse_js_violationmanagementEntityList = [];
      this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList = [];
      this.visible = true;
      this.dataForm.id = id || "";
      this.roleId = [];
      this.$nextTick(() => {
        this.$refs["dataForm"].resetFields();
        // 获取公司+部门
        getDepartmentSelector(this.$store.getters.organizeId).then((res) => {
          this.departmentTreeData = res.data.list;
        });

        // 获取岗位
        getPositionSelector(this.$store.getters.organizeId).then((res) => {
          this.positionTreeData = res.data.list;
        });

        // 获取民族
        this.$store
          .dispatch("base/getDictionaryData", { sort: "Nation" })
          .then((res) => {
            this.nationTreeData = res;
          });

        // 获取学历
        this.$store
          .dispatch("base/getDictionaryData", { sort: "Education" })
          .then((res) => {
            this.educationTreeData = res;
          });

        // 获取证件类型
        this.$store
          .dispatch("base/getDictionaryData", { sort: "certificateType" })
          .then((res) => {
            this.certificatesTypeTreeData = res;
          });

        // 获取性别
        this.$store
          .dispatch("base/getDictionaryData", { sort: "sex" })
          .then((res) => {
            this.genderTreeData = res;
          });

        if (this.dataForm.id) {
          this.formLoading = true;
          getUserInfo(this.dataForm.id,this.$store.getters.organizeId)
            .then((res) => {
              this.dataForm = res.data;

              if (this.dataForm.roleId)
                this.roleId = this.dataForm.roleId.split(",");
              this.photoList = this.dataForm.photo
                ? JSON.parse(this.dataForm.photo)
                : [];
              this.dataForm.xy_hse_ar_jobtransferrecordEntityList = this
                .dataForm.xy_hse_ar_jobtransferrecordEntityList
                ? this.dataForm.xy_hse_ar_jobtransferrecordEntityList
                : [];
              this.dataForm.xy_hse_ar_trainingrecordEntityList = this.dataForm
                .xy_hse_ar_trainingrecordEntityList
                ? this.dataForm.xy_hse_ar_trainingrecordEntityList
                : [];
              this.dataForm.xy_hse_tr_personneldocumentsEntityList = this
                .dataForm.xy_hse_tr_personneldocumentsEntityList
                ? this.dataForm.xy_hse_tr_personneldocumentsEntityList
                : [];
              this.dataForm.xy_hse_ar_safetyresponsibilityEntityList = this
                .dataForm.xy_hse_ar_safetyresponsibilityEntityList
                ? this.dataForm.xy_hse_ar_safetyresponsibilityEntityList
                : [];
              this.dataForm.xy_hse_zyjkgl_lbypconsumEntityList = this.dataForm
                .xy_hse_zyjkgl_lbypconsumEntityList
                ? this.dataForm.xy_hse_zyjkgl_lbypconsumEntityList
                : [];
              this.dataForm.xy_hse_js_violationmanagementEntityList = this
                .dataForm.xy_hse_js_violationmanagementEntityList
                ? this.dataForm.xy_hse_js_violationmanagementEntityList
                : [];
              this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList = this.dataForm
                .xy_hse_zyjkgl_zbtjryqdEntityList
                ? this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList
                : [];
              this.formLoading = false;
            })
            .catch(() => (this.formLoading = false));
        } else {
          this.dataForm.organizeId = organizeId;
        }
      });
    },

    goBack() {
      this.$emit("close");
    },
    roleIdChange() {
      this.dataForm.roleId = this.roleId.toString();
    },
    handleAvatarSuccess(res) {
      if (res.code === 200 && res.data && res.data.url) {
        this.dataForm.headIcon = res.data.url;
      } else {
        this.$message.error("头像上传失败");
      }
    },
    handleConfirm() {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          this.btnLoading = true;
          const formMethod = this.dataForm.id ? updateUser : createUser;

          formMethod(this.dataForm)
            .then((res) => {
              this.$message({
                message: res.msg,
                type: "success",
                duration: 1500,
                onClose: () => {
                  this.visible = false;
                  this.btnLoading = false;
                  this.$emit("close", true);
                },
              });
            })
            .catch(() => {
              this.btnLoading = false;
            });
        }
      });
    },
    addHandlexy_hse_ar_jobtransferrecordEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_ar_jobtransferrecordEntityList.push(item);
    },
    handleDelxy_hse_ar_jobtransferrecordEntityList(index) {
      this.dataForm.xy_hse_ar_jobtransferrecordEntityList.splice(index, 1);
    },
    addHandlexy_hse_ar_trainingrecordEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_ar_trainingrecordEntityList.push(item);
    },
    handleDelxy_hse_ar_trainingrecordEntityList(index) {
      this.dataForm.xy_hse_ar_trainingrecordEntityList.splice(index, 1);
    },
    addHandlexy_hse_tr_personneldocumentsEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_tr_personneldocumentsEntityList.push(item);
    },
    handleDelxy_hse_tr_personneldocumentsEntityList(index) {
      this.dataForm.xy_hse_tr_personneldocumentsEntityList.splice(index, 1);
    },
    addHandlexy_hse_ar_safetyresponsibilityEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_ar_safetyresponsibilityEntityList.push(item);
    },
    handleDelxy_hse_ar_safetyresponsibilityEntityList(index) {
      this.dataForm.xy_hse_ar_safetyresponsibilityEntityList.splice(index, 1);
    },
    addHandlexy_hse_zyjkgl_lbypconsumEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_zyjkgl_lbypconsumEntityList.push(item);
    },
    handleDelxy_hse_zyjkgl_lbypconsumEntityList(index) {
      this.dataForm.xy_hse_zyjkgl_lbypconsumEntityList.splice(index, 1);
    },
    addHandlexy_hse_js_violationmanagementEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_js_violationmanagementEntityList.push(item);
    },
    handleDelxy_hse_js_violationmanagementEntityList(index) {
      this.dataForm.xy_hse_js_violationmanagementEntityList.splice(index, 1);
    },
    addHandlexy_hse_zyjkgl_zbtjryqdEntityList() {
      let item = {
        positionchangecode: undefined,

        changenature: undefined,

        changetime: undefined,

        originalcompany: undefined,

        originaldepartment: undefined,

        companyafterchange: undefined,

        deoartmentafterchange: undefined,

        jobafterchange: undefined,

        trainingname: undefined,

        trainingtype: "",

        traininglevel: "",

        trainingway: "",

        testway: "",

        testresult: undefined,

        passcondition: "",

        remark: undefined,

        certificatename: undefined,

        certificatenumber: undefined,

        effectivedate: undefined,

        expirydate: undefined,

        annualverification: "",

        nextcheckdate: undefined,

        status: undefined,

        file: undefined,

        consumtime: undefined,

        ldypname: undefined,

        ldypmode: undefined,

        ldypquantit: undefined,

        distributdept: undefined,

        dstributer: undefined,

        violationname: undefined,

        violationtype: undefined,

        occurrencetime: undefined,

        accidentdescription: undefined,

        inspector: undefined,

        checktime: undefined,

        penaltyamount: undefined,

        violationphotos: undefined,

        exposure: undefined,

        diseases: undefined,

        conclusion: undefined,

        recheck: undefined,

        enclosure: undefined,
      };
      this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList.push(item);
    },
    handleDelxy_hse_zyjkgl_zbtjryqdEntityList(index) {
      this.dataForm.xy_hse_zyjkgl_zbtjryqdEntityList.splice(index, 1);
    },
  },
};
</script>
<style lang="scss" scoped>
.user-form {
  .main {
    padding: 10px 30px 0;
  }
  >>> .el-select,
  >>> .el-date-editor {
    width: 100%;
  }
  >>> .avatar-uploader {
    .el-upload {
      border: 1px dashed #dcdfe6;
      border-radius: 6px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
    }
    .el-upload:hover {
      border-color: #409eff;
    }
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 130px;
    height: 130px;
    line-height: 130px;
    text-align: center;
  }
  .avatar {
    width: 130px;
    height: 130px;
    display: block;
  }
}
</style>
